import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/home/book'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import( /* webpackChunkName: "home" */ '@/views/home'),
    children: [{
      path: '/home/book',
      name: 'book',
      component: () => import( /* webpackChunkName: "book" */ '@/views/home/book'),
    }, {
      path: '/home/my',
      name: 'my',
      component: () => import( /* webpackChunkName: "my" */ '@/views/home/my'),
    }, {
      path: '/home/coll',
      name: 'coll',
      component: () => import( /* webpackChunkName: "coll" */ '@/views/home/coll'),
    }]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import( /* webpackChunkName: "login" */ '@/views/login')
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import( /* webpackChunkName: "detail" */ '@/views/detail')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import( /* webpackChunkName: "search" */ '@/views/search')
  },
  {
    path: '*',
    name: 'notFound',
    component: () => import('@/views/notFound')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router